#ifndef SCENE_H_
#define SCENE_H_

#include <list>
#include <vector>

#include <GL/glew.h>

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform2.hpp>
#include <glm/gtx/projection.hpp>

#include "base/GLStructure.h"
#include "GLProgramMgr.h"
#include "listeners/MouseListener.h"
#include "listeners/KeyListener.h"
#include "base/GLView.h"

class Scene : public MouseListener, public KeyListener {
private:
	//! Called when a key is pressed on keyboard
	virtual void OnKeyDown(int nKey, char cAscii);

	//! Called when Mouse button is pressed
	virtual void OnMouseDown(int button, int x, int y){};

	//! Called when Mouse button is released
	virtual void OnMouseUp(int button, int x, int y){};

	//! Called when Mouse is moved (without pressing any button)
	virtual void OnMouseMove(int x, int y);

	//! Called while Left Mouse button is pressed.
	virtual void OnLeftMouseDrag(int x, int y){};

	//! Called when mouse wheel is used
	virtual void OnMouseWheel(int nWheelNumber, int nDirection, int x, int y);

	/*
	 * Select camera with @id.
	 * Unregister previous camera listener and register new ones.
	 */
	void setCamera(int id);

	/*
	 * The cameras id are indicated by their position on the vector
	 * 0 = Default camera
	 * 1 = Aerial camera
	 * 2 = Ground camera
	 */
	std::vector<GLView*> cameras;
	int cameraSelected;

	float dirtiness;
protected :
	std::list<GLStructure*> objects;
	GLProgramMgr* programMgr;

	void addObject(GLStructure* structure);
	void createScene();
public:
	Scene();
	void update();
	void run();
	~Scene();
};


#endif /* SCENE_H_ */
